package com.example.demo;

import org.springframework.web.bind.annotation.*;

import java.util.Arrays;
import java.util.List;

@RestController
@RequestMapping("/hello")
public class SayHello {
    @RequestMapping(value = "/hello",method = {RequestMethod.POST,RequestMethod.GET})
    public String hello(String name){
        return "名字是  "+name ;
    }
    @RequestMapping("/r1")
    public String r1(@RequestBody String[] arr){
        return Arrays.toString(arr);
    }

    @RequestMapping("/r2")
    public List<String> r2(@RequestParam(required = false) List<String> list){
        return list;
    }
}
